﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DataVirtualization;
using System.Windows.Controls.Primitives;

namespace StudioEditorTest.CodeEditor
{
	/// <summary>
	/// Interaction logic for CodeEditor.xaml
	/// </summary>
	public partial class CodeEditor : UserControl
	{
		public CodeEditor()
		{
			InitializeComponent();
			codeLinesCollection = new VirtualizingCollection<CodeLine>(new CodeDataProvider());
			inputManager = new InputManager(this);
		}

		protected override void OnPreviewKeyDown(KeyEventArgs e)
		{
			CodeLinePresenter line = listView.ItemContainerGenerator.ContainerFromIndex(listView.SelectedIndex) as CodeLinePresenter;
			
		}

		private void ListView_Loaded(object sender, RoutedEventArgs e)
		{
			DataContext = codeLinesCollection;
		}

		public void Test()
		{
			CodeDataProvider provider = codeLinesCollection.ItemsProvider as CodeDataProvider;
			provider.Count = new Random().Next(100000);
			listView.Items.Refresh();
		}
		InputManager inputManager;
		VirtualizingCollection<CodeLine> codeLinesCollection;
	}
}
